<template>
	<view class="box">
		<view class="eqBox" v-for="(item,index) in list" :key="index" @click="toCatalogue(item.path)">
			<u-transition :show="true" mode="fade" :duration="index*300">
				<image :src="item.iconSrc" class="image"></image>
				<view class="scan">{{item.name}}</view>
			</u-transition>
		</view>
		<!-- <files-upload></files-upload> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [{
						name: '隐患信息',
						iconSrc: '../../static/iconTrouble.png',
						path:'hiddenInformation'
					}, {
						name: '待办管理',
						iconSrc: '../../static/iconCommission.png',
						path:'agentManagement'
					},
					{
						name: '已办管理',
						iconSrc: '../../static/iconFinished.png',
						path:'hasToDoManagement'
					},
					{
						name: '档案管理',
						iconSrc: '../../static/iconArchives.png',
						path:'archivesManagement'
					},
					{
						name: '扫一扫',
						iconSrc: '../../static/scan.png',
						path:''
					},
				]
			}
		},
		created() {
			
		},
		methods: {
			toCatalogue(e) {
				if(e){
					uni.navigateTo({
						url: "./" + e
					})
				}else{
					// uni.navigateTo({
					// 	url:"./investigateScanFun?resultValue="
					// })
					let that = this;
					uni.scanCode({
						success: (res)=> {
							console.log(res.result)
							let devID = res.result
							// let devID = '01021483677888824872960'
							that.request(that.$api.getFmHiddenDangerDetail+ devID, {},'GET').then((res) => {
								console.log(1,res)
								if(res.resultValue){
									let resultValue = JSON.stringify(res.resultValue)
									uni.navigateTo({
										url:"./investigateScanFun?resultValue="+resultValue+"&fmQrCode="+devID
									})
								}
								
							}).catch((err1) => {
								console.log(2,err1)
							})
						},
						fail: (err) => {
							console.log(3,err)
						}
					});
				}
			}
		}
	}
</script>

<style>
	.box {
		box-sizing: border-box;
		padding: 50rpx 30rpx;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
	}

	.eqBox {
		margin: 20rpx 10rpx;
		width: 128rpx;
		text-align: center;
	}
	
	.image{
		width: 128rpx;
		height: 128rpx;
	}
	.scan {
		font-family: PingFangSC-Regular;
		font-weight: Regular;
		font-size: 28rpx;
		color: #414A53;
		text-align: center;
	}

</style>
